import { api_login } from '@/api/login'
import { create } from 'zustand'
export interface UserType {
  name: string
  userId: string
  setUserId: (id: string) => void
  setUserName: (name: string) => void
  api_UserInfo: (params: any) => void
}
export const useUserStore = create<UserType>((set) => ({
  name: '',
  userId: '',
  setUserId: (id) => set({ userId: id }),
  setUserName: (name) => set({ name: name }),
  api_UserInfo: async (params: any) => {
    const { data } = await api_login(params)
    setTimeout(() => {
      set({ name: data.data.name })
    }, 1000)
  },
}))
